package inventoryServe.service.impl;

import inventoryServe.po.User;
import inventoryServe.mapper.UserMapper;
import inventoryServe.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;



@Service
@Transactional
public class UserServiceImpl implements UserService {
    // 注解注入
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> allUser(User user) {
        return this.userMapper.allUser(user);
    }

    @Override
    public Boolean deleteUser(Integer id) {
        return this.userMapper.deleteUser(id) > 0;
    }

    @Override
    public Boolean addUser(User user) {
        return this.userMapper.addUser(user) > 0;
    }

    @Override
    public User userOfId(Integer id) {
        return this.userMapper.userOfId(id);
    }

    @Override
    public Boolean editUser(User user) {
        return this.userMapper.editUser(user)>0;
    }

    @Override
    public Boolean isEnableUser(Integer id, Integer flag) {
        return this.userMapper.isEnableUser(id,flag) > 0;
    }

    @Override
    public User login(User user) {
        return userMapper.login(user);
    }

    @Override
    public Boolean editPass(User user) {
        return userMapper.editPass(user) > 0;
    }
}
